﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Collections;
using System.Data;
using CE.Database;

/// <summary>
/// Summary description for HLSelectedItemDB
/// </summary>
/// 
namespace CE.HomeLoan
{
    public class HLSelectedItemDB
    {
        public HLSelectedItemDB()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public Int64 Insert(HLSelectedItem hlselecteditem)
        {
            MyDatabase _db = new MyDatabase();
            Int64 _result = -1;
            string _spName = "sprocHLSelectedItemsInsertSingleItem";

            SortedList _sPara = new SortedList();

            _sPara.Add("@HLSelectedListId", hlselecteditem.HLSelectedListId);
            _sPara.Add("@HLId", hlselecteditem.HLId);
            _sPara.Add("@RefCEUserId", hlselecteditem.RefCEUserId);
            _sPara.Add("@SelectItemId1", hlselecteditem.SelectedItemId1);
            _sPara.Add("@SelectItemId2", hlselecteditem.SelectedItemId2);
            _sPara.Add("@SelectItemId3", hlselecteditem.SelectedItemId3);
            _sPara.Add("@SelectItemId4", hlselecteditem.SelectedItemId4);
            _sPara.Add("@SelectItemId5", hlselecteditem.SelectedItemId5);
            _sPara.Add("@SelectItemId6", hlselecteditem.SelectedItemId6);
            _sPara.Add("@SelectItemId7", hlselecteditem.SelectedItemId7);
            _sPara.Add("@SelectItemId8", hlselecteditem.SelectedItemId8);
            _sPara.Add("@SelectItemId9", hlselecteditem.SelectedItemId9);
            _sPara.Add("@SelectItemId10", hlselecteditem.SelectedItemId10);
            _sPara.Add("@SelectItemId11", hlselecteditem.SelectedItemId11);
            _sPara.Add("@SelectItemId12", hlselecteditem.SelectedItemId12);
            _sPara.Add("@SelectItemId13", hlselecteditem.SelectedItemId13);
            _sPara.Add("@SelectItemId14", hlselecteditem.SelectedItemId14);
            _sPara.Add("@SelectItemId15", hlselecteditem.SelectedItemId15);
            _sPara.Add("@SelectItemId16", hlselecteditem.SelectedItemId16);
            _sPara.Add("@SelectItemId17", hlselecteditem.SelectedItemId17);
            _sPara.Add("@SelectItemId18", hlselecteditem.SelectedItemId18);
            _sPara.Add("@SelectItemId19", hlselecteditem.SelectedItemId19);
            _sPara.Add("@SelectItemId20", hlselecteditem.SelectedItemId20);
            _sPara.Add("@ViewedDetailId", hlselecteditem.ViewedDetailId);
            _sPara.Add("@Status", hlselecteditem.Status == true ? 1 : 0);

            _result = _db.ExecuteSP(_spName, _sPara);

            return _result;
        }

        public void Delete(HLSelectedItem hlselecteditem)
        {
            MyDatabase _db = new MyDatabase();
            string _spName = "sprocHLSelectedItemsDeleteItem";
            SortedList _sPara = new SortedList();
            _sPara.Add("@HLId", hlselecteditem.HLId);
            _db.ExecuteSP(_spName, _sPara);
        }

        public DataTable GetHLSelectedItemImageList(Int64 HLId)
        {
            DataTable _selectedcardimage = null;
            MyDatabase _db = new MyDatabase();
            string _spName = "sprocHLSelectedItemsImageItemList";

            SortedList _spara = new SortedList();
            _spara.Add("@HLId", HLId);

            using (DataTable _dt = _db.GetDataTableBySP(_spName, _spara))
            {
                if (_dt != null && _dt.Rows.Count > 0)
                {
                    _selectedcardimage = _dt;
                }
            }
            return _selectedcardimage;
        }

    }
}